'''
Created on 15/03/2012

@author: nicolas
'''

import pylab as p
from matplotlib.pyplot import plot

N = 200
K = 50

resultado = []

for n in range(N + 1):
    sumatoria = 0
    for k in range(1, K + 1): #saco el 0 para evitar 0/0 = nan 
        a_k = (p.sin(p.pi * k / 4)) / (p.pi * k)
        sumatoria += (a_k * p.exp(1j * p.pi * k * n / 32)).real
        
    resultado.append(sumatoria)


plot(resultado)
p.savefig('ej11_f_n'+str(N)+'_k'+str(K)+'.png')
p.show()
